package com.atmilan.quartz.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.atmilan.quartz.mapper.MoneyExchangeMapper;
import com.atmilan.quartz.model.entity.buyer.MoneyExchange;
import com.atmilan.quartz.service.IMoneyExchangeService;
import com.atmilan.quartz.utils.RedisUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * x
 *
 * @author muyu.myw
 * @date 2020/10/20 15:27
 */
@Service
public class MoneyExchangeServiceImpl extends ServiceImpl<MoneyExchangeMapper, MoneyExchange> implements IMoneyExchangeService {
	@Autowired
	MoneyExchangeMapper moneyExchangeDao;
	@Autowired
	RedisUtil redisUtil;

	@Override
	public MoneyExchange getExchangeByName(String name) {
		if (StringUtils.isBlank(name)) {
			return null;
		}
		return moneyExchangeDao.selectOne(Wrappers.<MoneyExchange>lambdaQuery().eq(MoneyExchange::getName, name).last("LIMIT 1"));
	}
}
